package edu.gmu.projects.fireresponder.comm;

import java.util.ArrayList;
import java.util.List;

public abstract class MessageCommunicator {

	protected static List<IFirstResponderAlertListener> frListeners = new ArrayList<IFirstResponderAlertListener>();
	protected static List<MessageListener> listeners = new ArrayList<MessageListener>();

	protected boolean encrypt;

	public static void addMessageListener(MessageListener listener) {
		listeners.add(listener);
	}

	public static void removeUdpBroadcastListener(MessageListener listener) {
		listeners.remove(listener);
	}

	public static void addFirstResponderAlertListener(IFirstResponderAlertListener listener) {
		frListeners.add(listener);
	}

	public static void removeFirstResponderAlertListener(IFirstResponderAlertListener listener) {
		frListeners.remove(listener);
	}

	public MessageCommunicator() {
		super();
	}

	public abstract String receive();

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.lmco.atl.swtp.network.Broadcast#send(com.lmco.atl.swtp.network.String
	 * )
	 */
	public abstract boolean send(String msg);

	public void encryptMessages(boolean encrypt) {
		this.encrypt = encrypt;
	}

	public boolean isEncrypted() {
		return encrypt;
	}
}